/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.yandex.skipass;

/**
 *
 * @author vlad
 */
public enum TimeInterval {

    MORNING(9 * 60 * 60 * 1000, 13 * 60 * 60 * 1000,
            PassType.WEEKDAY, PassType.WEEKEND),
    AFTERNOON(13 * 60 * 60 * 1000, 17 * 60 * 60 * 1000,
            PassType.WEEKDAY, PassType.WEEKEND),
    DAY1(0, 24 * 60 * 60 * 1000,
            PassType.WEEKDAY,
            PassType.WEEKEND),
    DAY2(0, 2 * 24 * 60 * 60 * 1000,
            PassType.WEEKDAY,
            PassType.WEEKEND),
    DAY5(0, 5 * 24 * 60 * 60 * 1000,
            PassType.WEEKDAY);

    private final long startTime;
    private final long endTime;
    private PassType[] supportedTypes;

    TimeInterval(long startTime, long endTime,
            PassType... supportedTypes) {
        this.startTime = startTime;
        this.endTime = endTime;
        this.supportedTypes = supportedTypes;
    }

    public PassType[] supported() {
        PassType[] result
                = new PassType[supportedTypes.length];
        System.arraycopy(supportedTypes, 0, result, 0, supportedTypes.length);
        return result;
    }

    public long startTime() {
        return startTime;
    }

    public long endTime() {
        return endTime;
    }

}
